/* 
Create Structure needed to track Replication Latency

Notes: Created in the Master database

*/
Use master
go

if exists (select 1 from sys.sysobjects where name = 'ReplicationLatencyTracking' and type = 'U')
begin
drop table ReplicationLatencyTracking
end
if exists (select 1 from sys.sysobjects where name = 'ReplicationLatencyHistory' and type = 'U')
begin
drop table ReplicationLatencyHistory
end


create table ReplicationLatencyTracking (AlertTime datetime2 not null
										,XtiviaNotifcation  char(1) null
										,LoanmartNotification char(1) null
										,AllClearNotification char(1) null)
										
create table ReplicationLatencyHistory (AlertTime datetime2 not null
                                         ,XtiviaNotifcation  char(1) null
										,LoanmartNotification char(1) null
											,AllClearNotification char(1) null)